//
//  ProgressHUD.m
//  WestAir
//
//  Created by Henry on 16/8/17.
//  Copyright © 2016年 Henry. All rights reserved.
//

#import "ProgressHUD.h"
#import "SVProgressHUD.h"

@interface ProgressHUD()
{
}

@property (nonatomic, strong) NSString *progreCMCCIOTtring;

@end

@implementation ProgressHUD

//单例方法
+ (ProgressHUD*)sharedInstance {
    static dispatch_once_t once;
    
    static ProgressHUD *instance;
    dispatch_once(&once, ^{
        instance = [[self alloc] init];
    });
    return instance;
}

//显示菊花
+ (void)show
{
    [SVProgressHUD show];
}

//显示菊花带字
+ (void)showWithString:(NSString*)string
{
    [SVProgressHUD showWithStatus:string];
}

//更新进度
+ (void)setProgress:(CGFloat)progress
{
    if ([[ProgressHUD sharedInstance].progreCMCCIOTtring notEmpty]) {
        [SVProgressHUD showProgress:progress status:[ProgressHUD sharedInstance].progreCMCCIOTtring];
    }else{
        [SVProgressHUD showProgress:progress];
    }
}

//显示进度
+ (void)showProgress:(CGFloat)progress
{
    [[ProgressHUD sharedInstance] setProgreCMCCIOTtring:nil];
    [SVProgressHUD showProgress:progress];
}

//显示进度带字
+ (void)showProgress:(CGFloat)progress withString:(NSString*)status
{
    [[ProgressHUD sharedInstance] setProgreCMCCIOTtring:status];
    [SVProgressHUD showProgress:progress status:status];
}

//隐藏菊花
+ (void)hidden
{
    [SVProgressHUD dismiss];
}

//隐藏菊花,延时X秒
+ (void)hiddenWithDelay:(NSTimeInterval)delay
{
    [SVProgressHUD dismissWithDelay:delay];
}

//推出所有菊花
+ (void)popActivity
{
    [SVProgressHUD popActivity];
}

//显示一个无图标提示信息。所述显示时间取决于给定的字符串的长度（ 0.5至5秒）。
+ (void)showAlertWithString:(NSString *)string
{
    [SVProgressHUD showInfoWithStatus:string];
}

//显示一个成功图标提示信息。所述显示时间取决于给定的字符串的长度（ 0.5至5秒）。
+ (void)showSuccessWithWithString:(NSString*)string
{
    [SVProgressHUD showSuccessWithStatus:string];
}

//显示一个失败图标提示信息。所述显示时间取决于给定的字符串的长度（ 0.5至5秒）。
+ (void)showErrorWithString:(NSString *)string
{
    [SVProgressHUD showErrorWithStatus:string];
}

//显示一个带图提示信息。所述显示时间取决于给定的字符串的长度（ 0.5至5秒）。
+ (void)showImage:(UIImage*)image string:(NSString*)string
{
    [SVProgressHUD showImage:image status:string];
}

@end
